package org.example.dormsystem.controller;

import org.example.dormsystem.pojo.Dormitory;
import org.example.dormsystem.pojo.Result;
import org.example.dormsystem.service.FloorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/floor")
public class FloorController {

    @Autowired
    FloorService floorService;

    @GetMapping("/floorInfo")
    Result floorInfo(String floorNumber){
        List<Dormitory> list = floorService.findRoomNumberByFloorNumber(floorNumber);
        return Result.success(list);
    }
}
